package com.booksystem.campuslibrarymanagementsystem.utils;

import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.IntStream;

public class CodeUtil {
    private CodeUtil(){}

    /**
     * 生成一个6位数字的随机验证码
     * @return 随机生成的6位数字验证码
     */

    private static String Code() {
        return String.join("", IntStream.range(0, 6)
                .mapToObj(i -> String.valueOf(ThreadLocalRandom.current().nextInt(10)))
                .toArray(String[]::new));
    }

    public static String codeGet(){
        return Code();
    }

}
